<html>
<body>
<script language="javascript">
var timerID;
var i = 1;
var a = new Array() ;
   a[0] = '1.jpg';
   a[1] = '2.jpg';
   a[2] = '3.jpg';
 
  function f1() 
  {
  	 a[i] = i+'.jpg';
     var obj= document.getElementById('imgFor');
     //obj.src = a[i%3];
     obj.src = a[i];
     i++;
  }

</script>
<table>
<form name="frm1">
<tr><td><img id="imgFor" src="1.jpg"></tr></td>
<tr><td><input name="b1" type="button" value="start" onClick="javascript:timerID=setInterval(f1,30);document.frm1.b1.disabled=true;document.frm1.b2.disabled=false;"></tr></td>
<tr><td><input name="b2" type="button" value="stop" onClick="javascript:clearInterval(timerID);document.frm1.b1.disabled=false;document.frm1.b2.disabled=true;" disabled=true></tr></td>
</form>
</table>
</body>
</html> 